package com.group.service.impl;

import com.group.pojo.Job;
import com.group.mapper.JobMapper;
import com.group.service.JobService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author group
 * @since 2021-09-06
 */
@Service
public class JobServiceImpl implements JobService {

    @Autowired
    private JobMapper jobMapper;

    @Override
    public List<Job> findAll() {
        return jobMapper.findAll();
    }

    @Override
    public List<Job> findJobVague(Job job) {
        List<Job> jobList = jobMapper.findJobVague(job);
        if(jobList.size()>0){
            return jobList;
        }
        return null;
    }

    @Override
    public boolean addJob(Job job) {
        if(jobMapper.addJob(job)>0){
            return true;
        }
        return false;
    }

    @Override
    public boolean delJobById(int id) {
        if(jobMapper.delJobById(id)>0){
            return true;
        }
        return false;
    }

    @Override
    public boolean updateJob(Job job) {
        if(jobMapper.updateJob(job)>0){
            return true;
        }
        return false;
    }

    @Override
    public List<Job> findJobById(int id) {
        System.out.println(id);
        List<Job> jobList = jobMapper.findJobById(id);
        if(jobList.size()>0){
            return jobList;
        }
        return null;
    }

}
